package com.tiza.xiaoyoubao.ui.fragment;

import android.os.Bundle;
import android.widget.TextView;

import com.orhanobut.hawk.Hawk;
import com.tianze.library.base.BaseFragment;
import com.tianze.library.view.SimpleDialog;
import com.tiza.xiaoyoubao.R;
import com.tiza.xiaoyoubao.app.Constants;
import com.tiza.xiaoyoubao.app.UIHelper;
import com.tiza.xiaoyoubao.entity.BrowseJDTaskOrderInfo;
import com.tiza.xiaoyoubao.entity.BrowseMGJTaskOrderInfo;

import butterknife.BindView;

/**
 * Created by mapple on 17/4/14.
 */

public class BrowseMGJOperationTaskFragment extends BaseFragment {
    BrowseMGJTaskOrderInfo mOrderInfo = Hawk.get(Constants.KEY_BROWSEMPMGJTASKOEDER_INFO, (BrowseMGJTaskOrderInfo) null);
    @BindView(R.id.tv_shopName)
    TextView tv_shopName;
    @BindView(R.id.tv_shopDescribe)
    TextView tv_shopDescribe;
    @BindView(R.id.tv_showPrice)
    TextView tv_showPrice;
    @BindView(R.id.tv_taskType)
    TextView tv_taskType;
    @BindView(R.id.tv_keyWord)
    TextView tv_keyWord;
    @BindView(R.id.tv_xiaoliang)
    TextView tv_xiaoliang;
    @BindView(R.id.tv_location)
    TextView tv_location;
    @BindView(R.id.tv_city)
    TextView tv_city;
    @BindView(R.id.tv_priceInterval)
    TextView tv_priceInterval;
    @BindView(R.id.tv_additionalRequest)
    TextView tv_additionalRequest;
    @Override
    protected int getLayoutId() {
        return R.layout.fragment_browse_mgj_operation_task;
    }

    @Override
    protected void initData() {

    }

    @Override
    protected void initView() {
        tv_shopName.setText(mOrderInfo.getShopName());
        tv_shopDescribe.setText(mOrderInfo.getTitle());
        tv_keyWord.setText(mOrderInfo.getKeywords());
        tv_taskType.setText(mOrderInfo.getTypeName());
        tv_xiaoliang.setText(mOrderInfo.getReceiving());
        tv_location.setText(mOrderInfo.getLocation());
        tv_city.setText(mOrderInfo.getCity());
        tv_priceInterval.setText(mOrderInfo.getPrice());
        if (mOrderInfo.getRemarks().equals(" ")) {
            tv_additionalRequest.setText("商家无其他要求");
        } else {
            tv_additionalRequest.setText(mOrderInfo.getRemarks());
        }
    }
    @Override
    public boolean onBackPressed() {
        showCustomConfirmDialog("返回后台后将不保存所做操作，下次需要重新上传截图哦，确定要返回吗", "确定", "取消",
                                new SimpleDialog.OnSimpleClickListener() {
                                    @Override
                                    public void onClick(SimpleDialog simpleDialog) {
                                        Bundle args = new Bundle();
                                        args.putSerializable("info", mOrderInfo);
                                        args.putString("state", "browseMgj");
                                        UIHelper.showBrowseMpTask2(mActivity,args);
                                        simpleDialog.dismiss();
                                    }
                                }, new SimpleDialog.OnSimpleClickListener() {
                    @Override
                    public void onClick(SimpleDialog simpleDialog) {
                        simpleDialog.dismiss();
                    }
                }
        );
        return true;
    }
}
